const mongoose = require('mongoose');
const { ObjectId } = mongoose.Schema;

const locationSchema = mongoose.Schema({
  line: Number,
  column: Number,
}, { _id: false });
const macroSchema = mongoose.Schema({
  location: {
    begin: locationSchema,
    end: locationSchema,
  },
  '@expansion': String,
}, { _id: false });

/**
 * Export model definition object.
 */
module.exports = {
  projectId: ObjectId,
  versionId: { type: ObjectId, index: true },
  fileId: { type: ObjectId, unique: true, index: true },
  macros: [macroSchema],
};
